#include<iostream>
using namespace std;
typedef struct TreeNode
{
	char val;
	struct TreeNode* left;
	struct TreeNode* right;
}TNode;
TNode* Pre_create(string s, int* n)
{
	if (s[*n] == '.' || s[*n] == 0)
		return NULL;
	TNode* root = new TNode;
	root->val = s[*n];
	(*n)++;
	root->left = Pre_create(s, n);
	(*n)++;
	root->right = Pre_create(s, n);
	return root;
}
void right_mid_order(TNode* root,int h)
{
	
	
	if (root == NULL)
		return;
	right_mid_order(root->right,h+2);
	int m = h;
	while (m--)
		cout << ' ';
	cout << root->val<<endl;
	right_mid_order(root->left,h+2);
}
int main()
{
	string s;
	cin >> s;
	int i = 0;
	TNode* root = Pre_create(s,&i);
	right_mid_order(root,1);
}